package com.chang.ware.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.chang.common.to.mq.StockLockedTo;
import com.chang.common.utils.PageUtils;
import com.chang.common.vo.SkuStockVo;
import com.chang.ware.entity.WareSkuEntity;
import com.chang.ware.vo.WareSkuLockVo;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * 商品库存
 *
 * @author chang
 * @email 2045807586@qq.com
 * @date 2024-01-03 16:01:52
 */
public interface WareSkuService extends IService<WareSkuEntity> {

    PageUtils queryPageByCondition(Map<String, Object> params);

    void addStock(Long purchaseDetailId, Long wareId, Integer skuNum);

    List<SkuStockVo> getStockBySkuId(List<Long> skuId);

    Map<Long, Integer> getBatchStockBySkuIds(List<Long> skuIds);

    Boolean orderLockStock(WareSkuLockVo wareSkuLockVo);

    void unlockStock(StockLockedTo stockLockedTo, Message message, Channel channel) throws IOException;

    void unlockStock(String orderSn, Message message, Channel channel);
}

